package cn.cvs.servlet;


import cn.cvs.dao.ResumeDao;
import cn.cvs.pojo.Resume;
import cn.cvs.utils.MyBatisUtil;
import org.apache.ibatis.session.SqlSession;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet(urlPatterns = "/SelectServlet")
public class SelectServlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        String sex = req.getParameter("sex");


        SqlSession sqlSession = MyBatisUtil.createSqlSession();
        List<Resume> listresume = sqlSession.getMapper(ResumeDao.class).Listresume(sex);
        req.getSession().setAttribute("resume",listresume);
        req.getRequestDispatcher("ListPage.jsp" ).forward(req,resp);
    }
}
